<?php 
	include ('../lib/twitese.php');
	$t = getTwitter();
	if ( isset($_POST['status']) && isset($_POST['id']) ) {
		if (!testReferer()) exit();
		if (trim($_POST['status']) == '') {
			echo 'empty';
			exit();
		}
		//$t->debug = true;
		$comment = $t->comment($_POST['status'], $_POST['id'], $_POST['cid']);
		if ($_POST['sent_status'] === 'true') {
			$t->repost($_POST['status'], $_POST['id']);
		}
		
		if (isset($comment->user)) {
		
			$user = $comment->user;
			$text = formatText($comment->text);
			$date = formatDate($comment->created_at);
			$statusid = $comment->id;
			echo "
			<div class=\"comment_ctn\">
				<span class=\"comment_author\">
					<a href=\"user.php?id=$user->screen_name\" target=\"_blank\"><img src=\"$user->profile_image_url\" title=\"$user->screen_name\" /></a>
				</span>
				<span class=\"comment_body\">
					<span class=\"status_word\">
						<input type=\"hidden\" class=\"comment_id\" value=\"$statusid\" />
						<a class=\"user_name\" href=\"user.php?id=$user->screen_name\" target=\"_blank\">$user->screen_name</a> $text 
						<span class=\"comment_date\">$date</span>
						<a href=\"#\" class=\"comment_delete_btn\">删除</a>
					</span>
				</span>
				<div class=\"clear\"></div>
			</div>
			";
			
			
		} else {
			echo 'error';
		}
		
	}

?>